package com.tz.colawallet.ui.biz;


import com.tz.colawallet.basecode.base.BaseBiz;
import com.tz.colawallet.basecode.base.BaseResp;
import com.tz.colawallet.bean.UserInfo;
import com.tz.colawallet.basecode.comm.BaseSubscribe2;
import com.tz.colawallet.basecode.comm.RetrofitHelp;

import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by Administrator on 2017/10/21.
 */

public class MainBiz extends BaseBiz {

    /**
     * 登录
     *
     * @param phone
     * @param pwd
     * @param callback
     */
    public void Login(String phone, String pwd, String alias, String loginType, final BaseBiz.Callback<UserInfo> callback) {
        com.add(RetrofitHelp.getSecretApi().loginCheck(phone, pwd, alias, loginType)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe2<BaseResp<UserInfo>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((UserInfo) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((UserInfo) obj);
                    }
                })
        );
    }



}
